<?php
/*
	分红中心
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
if($_RQ['op']=='main'){
	$return['ischecklogin']=model('jy_weishop/member')->checklogin('','','','',true);
	$return['xieyi']=$this->plugin_setting('xieyi');
	$member=model('core/member')->basic($_SESSION['uid']);
	$member['username']=$_SESSION['member']['username'];
	$return['member']=$member;
	$data=array();
	$daytime = mktime(0,0,0,date('m'),date('d'),date('Y'));
	$data['nobuytotal']=pdo_count('jy_kabao_order',array('total'=>0,'mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']));
	$data['buytotal']=pdo_getsum('jy_kabao_order',array('total >'=>0,'status <>'=>6,'mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']),'total');
	$data['baototal']=$data['nobuytotal']+$data['buytotal'];
	$data['nobuylastnum']=pdo_count('jy_kabao_order',array('status'=>0,'total'=>0,'mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']));
	$data['buylastnum']=pdo_getsum('jy_kabao_order',array('total >'=>0,'status'=>0,'mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']),'total');
	$data['baolastnum']=$data['nobuylastnum']+$data['buylastnum'];
	$data['baoisnum']=pdo_count('jy_kabao_order',array('frommid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']));
	$return['data']=$data;
	//公告列表
	$pindex = max(1, intval($post['page']));
	$psize = 10;
	$total='';
	$notice_list = pdo_getslice('jy_weishop_notice',array('uniacid'=>$_SESSION['uniacid'],'status'=>1),array($pindex,20),$total,array('id','title','createtime'),'','id desc');
	if($notice_list){
		foreach($notice_list as &$notice){
			$notice['createtime']=date('Y-m-d h:i',$notice['createtime']);
		}
	}
	$return['notice_list']=$notice_list;
	$status0 = pdo_count('jy_kabao_order',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid'],'status'=>0));
	$status1 = pdo_count('jy_kabao_order',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid'],'status'=>1));
	$status2 = pdo_count('jy_kabao_order',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid'],'status'=>2));
	$status3 = pdo_count('jy_kabao_order',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid'],'status'=>3));
	$status4 = pdo_count('jy_kabao_order',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid'],'status'=>4));
	$status5 = pdo_count('jy_kabao_order',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid'],'status'=>5));
	$status6 = pdo_count('jy_kabao_order',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid'],'status'=>6));
	$cartnums= pdo_getsum('jy_weishop_member_cart',array('mid'=> $_SESSION['uid'], 'uniacid' => $_SESSION['uniacid']),'total');
	$return['statics']=array(
			'status0'=>$status0,
			'status1'=>$status1,
			'status2'=>$status2,
			'status3'=>$status3,
			'cartnums'=>$cartnums
	);
	$return['shopset']=plugin('jy_weishop')->plugin_setting('shopset');
	$return['orderlist_url']='jy_shoplibao/orderlist/';
	set_html('title','会员中心');
	exi($return);
}
?>